package com.atguigu.guli.service.edu.controller.api;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.edu.entity.Teacher;
import com.atguigu.guli.service.edu.service.TeacherService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 讲师 前端控制器
 * </p>
 *
 * @author 加饭
 * @since 2021-10-26
 */
@Api(value = "用户前端控制器")
@RestController
@RequestMapping("/api/edu/teacher")
public class ApiTeacherController {
    @Autowired
    private TeacherService teacherService;

    @GetMapping("list")
    public R getTeacher(){
        List<Teacher> teacherList = teacherService.list();
        return R.ok().data("items",teacherList);
    }

    @GetMapping("getById/{id}")
    public R getById(@PathVariable("id") String id){
        Teacher teacher = teacherService.getById(id);
        return R.ok().data("item",teacher);
    }


}

